<template>
  <div>
    <div class="header">
      <van-icon
        class="back-btn"
        name="arrow-left"
        @click="$router.push('/order/tea')"
      />
      <div class="title">订单详情</div>
    </div>
    <div class="content">
      <img src="./images/logo.png" class="logo" />
      <div class="card">
        <div class="order-status">{{ orderStatus }}</div>
        <span>感谢您对茶百道的支持，期待您的再次光临</span>
        <div class="buy-btn" @click="$router.push('/buy')">再来一单</div>
      </div>
    </div>
  </div>
</template>

<script>
import { reqPaySuccess } from "@/api";
export default {
  data() {
    return {
      orderStatus: '',
    };
  },
  mounted() {
    this.paySuccess();
  },
  methods: {
    async paySuccess() {
      let data = {
        // 跳转后的url里面的参数
        out_trade_no: this.$route.query.out_trade_no,
        trade_no: this.$route.query.trade_no,
      };
      let res = await reqPaySuccess(data);
      if (res.code === 200) {
        this.orderStatus = res.msg;
      }
    }
  },
};
</script>

<style lang="less" scoped>
.header {
  width: 100%;
  height: 50px;
  background-color: #fff;
  position: fixed;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10;
  .back-btn {
    position: absolute;
    left: 10px;
    font-size: 18px;
  }
}
.content {
  padding: 100px 10px 0;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: center;
  .logo {
    width: 120px;
    height: 120px;
  }
  .card {
    width: 100%;
    height: 190px;
    background-color: #fff;
    border-radius: 15px;
    padding: 20px 0;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-around;
    margin-bottom: 10px;
    box-shadow: 0 0 3px rgb(0 0 0 / 10%);
    .order-status {
      font-size: 18px;
      font-weight: 600;
    }
    span {
      font-size: 14px;
      margin: 20px 0 30px;
    }
    .buy-btn {
      width: 85px;
      height: 30px;
      color: #143ea9;
      font-size: 13px;
      border: 1px solid #143ea9;
      border-radius: 15px;
      display: flex;
      justify-content: center;
      align-items: center;
    }
  }
}
</style>
